const {
    Schema,
    model
} = require('mongoose');

const tenantsSchema = new Schema({
    account: String,
    password: String,
    phone: String,
    name: String,
    IDCard: String,
    state: {
        type: Number,
        default: 1
    },
    credits: {
        type: Number,
        default: 90
    },
    ordersId: [{ //关联订单数组，实现通过用户查询订单
        type: Schema.Types.ObjectId,
        ref: 'ordersModel',
    }],

}, {
    versionKey: false
});

const tenantsModel = model('tenantsModel', tenantsSchema, 'tenants');

module.exports.tenantsModel = tenantsModel;